//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "adminActions\fn_ui_moderation_teleport.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_isAdmin","_dialog","_text","_selected_index","_duration","_type","_fadeout","_target_player","_player"];
PARAMS_3(_selected_index,_text,_player);
if (GVAR(AdminCmds) == 1) then {
	if (isNil "_text") exitWith {};
	if (_text == "") exitWith { hint localize "STR_MSO_AA_NOTEXTSELECTION"; };
	_isAdmin = (call mso_fnc_isAdmin);
	if (!isnil "mp_rights_fnc_isAdmin") then {
		_isAdmin = _isAdmin || ([] call mp_rights_fnc_isAdmin) || ([] call mp_rights_fnc_isModerator);
	};
	if (_isAdmin) then {
		_duration = 10;
		_type = "PLAIN";
		_fadeout = 10;
		_target_player = "";
		if (!isnil "_player" && {!isnull _player} && {isplayer _player}) then { _target_player = getPlayerUID _player; };
		[QGVAR(INFORM),[[_text,_duration,_type,_fadeout,_target_player],name player,getPlayerUID player]] call FUNC(raiseEvent);
	}else {
		hint localize "STR_MSO_AA_CMD_NA";
	};
};

TRACE("End");
TMFPROFILERSTOP;
